<?php
/* SVN FILE: $Id: coreVariables.php 257 2010-01-19 21:50:13Z supersmashbrothers $ */
/**
* ibMarket 2
* IP.Board 3.0
* Core variables extensions
* Defines the reset array, which caches to load, how to recache those caches, and the bitwise array
*
* @author $Author: supersmashbrothers $
* @copyright $Copyright$
* @version $Revision: 257 $
* @lastrevision $Date: 2010-01-19 21:50:13 +0000 (Tue, 19 Jan 2010) $
* @modifiedby $LastChangedBy: supersmashbrothers $
* @lastmodified $LastChangedDate: 2010-01-19 21:50:13 +0000 (Tue, 19 Jan 2010) $
* @filesource $URL: http://ipb-ibmarket.googlecode.com/svn/ibmarket2/trunk/admin/applications_addon/other/ibmarket/extensions/coreVariables.php $
 **/

$_RESET = array();
if( isset( $_REQUEST['plugin'] ) )
{
	if($_REQUEST['module'] != 'ajax')
	{
		$_RESET['module']	= 'plugin';
	}
	$_RESET['section']	= 'plugin';
}

$_LOAD = array();
$_LOAD['badwords']			= 1;
$_LOAD['bbcode']			= 1;
$_LOAD['emoticons']			= 1;

$CACHE['market_category'] = array( 
									'array'            => 1,
									'allow_unload'     => 0,
									'default_load'     => 1,
									'recache_file'     => IPSLib::getAppDir('ibmarket').'/sources/marketCache.php',
									'recache_class'    => 'marketCache',
									'recache_function' => 'cacheCategories' 
								);

$CACHE['market_items'] = array( 
								'array'            => 1,
								'allow_unload'     => 0,
								'default_load'     => 1,
								'recache_file'     => IPSLib::getAppDir('ibmarket').'/sources/marketCache.php',
								'recache_class'    => 'marketCache',
								'recache_function' => 'cacheItems' 
							);

$CACHE['market_plugin'] = array( 
								'array'            => 1,
							    'allow_unload'     => 0,
							    'default_load'     => 1,
								'recache_file'     => IPSLib::getAppDir('ibmarket').'/sources/marketCache.php',
								'recache_class'    => 'marketCache',
							    'recache_function' => 'cachePlugins' 
							);

$CACHE['market_wages'] = array( 
								'array'            => 1,
							    'allow_unload'     => 0,
						        'default_load'     => 1,
								'recache_file'     => IPSLib::getAppDir('ibmarket').'/sources/marketCache.php',
							    'recache_class'    => 'marketCache',
						        'recache_function' => 'cacheWages' 
						    );

$CACHE['market_taxes'] = array( 
								'array'            => 1,
							    'allow_unload'     => 0,
						        'default_load'     => 1,
								'recache_file'     => IPSLib::getAppDir('ibmarket').'/sources/marketCache.php',
							    'recache_class'    => 'marketCache',
						        'recache_function' => 'cacheTaxes' 
						    );

if($_REQUEST['plugin'])
{
	if(file_exists(IPSLib::getAppDir('ibmarket')."/plugins/".$_REQUEST['plugin']."/caches.php"))
	{
		require_once(IPSLib::getAppDir('ibmarket')."/plugins/".$_REQUEST['plugin']."/caches.php");
	}
}
if(IPS_AREA == 'admin' && $_GET['app'] == 'core' && $_GET['module'] == 'tools' && $_GET['section'] == 'cache')
{
	ipsRegistry::DB()->build(array('select'=>'directory','from'=>'market_plugins'));
	$q = ipsRegistry::DB()->execute();
	while($plugin = ipsRegistry::DB()->fetch($q))
	{
		if(file_exists(IPSLib::getAppDir('ibmarket')."/plugins/".$plugin['directory']."/caches.php"))
		{
			require(IPSLib::getAppDir('ibmarket')."/plugins/".$plugin['directory']."/caches.php");
		}
	}
}